<?php
    class sanphambs
    {
        public $MaSanPham = 0;
        public $TenSanPham = '';
		public $GiaGoc	= 0;
		public $GiaKhuyenMai = 0;
		public $HinhNho	= '';
        public $HinhTo	= '';
		public $MoTa	= '';
		public $ChiTiet	= '';
        public $HuongDan = '';
        public $SoLuong = 1;
        public $MaDonViTinh = 0;
        public $MaQuyCach = 0;
        public $MaXuatXu = 0;
        public $NgayNhap = '';
		public $MaLoaiSanPham = 0;
        public $MaLoaiSanPhamCap1 = 0;
        public $MaLoaiSanPhamCap2 = 0;
        public $MaLoaiSanPhamCap3 = 0;
        
        //Phân trang
        public $SoSanPham = 6;
        public $P = 1;
        
        
        public function getListInCart()
		{
			$db = new sanphamdb();
			return $db->getListInCart($this->MaSanPham);
		}
		
		public function getNumListInCart()
		{
			$db = new sanphamdb();
			return $db->getNumListInCart($this->MaSanPham);
		}
        
        public function getList()
		{
			$db = new sanphamdb();
			return $db->getList($this->MaSanPham, $this->TenSanPham);
		}
        
        public function getListNewProduct()
		{
			$db = new sanphamdb();
			return $db->getListNewProduct($this->SoSanPham);
		}
        
        public function getListDealsProduct()
		{
			$db = new sanphamdb();
			return $db->getListDealsProduct($this->SoSanPham);
		}
        
        public function add()
		{
			$db = new sanphamdb();
			return $db->add($this->TenSanPham, $this->GiaGoc, $this->GiaKhuyenMai, $this->HinhNho, $this->HinhTo, $this->MoTa, $this->ChiTiet, $this->HuongDan, $this->SoLuong, $this->MaDonViTinh, $this->MaQuyCach, $this->MaXuatXu, $this->NgayNhap, $this->MaLoaiSanPham, $this->MaLoaiSanPhamCap1, $this->MaLoaiSanPhamCap2, $this->MaLoaiSanPhamCap3);
		}
        
        public function update()
		{
			$db = new sanphamdb();
			return $db->update($this->MaSanPham, $this->TenSanPham, $this->GiaGoc, $this->GiaKhuyenMai, $this->HinhNho, $this->HinhTo, $this->MoTa, $this->ChiTiet, $this->HuongDan, $this->SoLuong, $this->MaDonViTinh, $this->MaQuyCach, $this->MaXuatXu, $this->NgayNhap, $this->MaLoaiSanPham, $this->MaLoaiSanPhamCap1, $this->MaLoaiSanPhamCap2, $this->MaLoaiSanPhamCap3);
		}
        
        public function delete()
        {
            $db = new sanphamdb();
            return $db->delete($this->MaSanPham);
        }
        
        public function issetType()
		{
			$db = new sanphamdb();
			return $db->issetType($this->TenSanPham);
		}
        
        public function issetTypes()
		{
			$db = new sanphamdb();
			return $db->issetTypes($this->MaSanPham, $this->TenSanPham);
		}
    }
?>